# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: shell_log.py 
@time: 2019/8/2 下午1:27
@note:
给编程增加日志功能
"""
import logging
import logging.config

def main():

    # logging.basicConfig(
    #     filename='app.log',
    #     level=logging.DEBUG,
    #     format='%(levelname)s:%(asctime)s:%(message)s'
    # )

    '读取日志配置文件'
    logging.config.fileConfig('logconfig.conf')

    hostname = 'www.python.org'
    item = 'spam'
    filename = 'data.csv'
    mode = 'r'

    logging.critical('Host %s unknown', hostname)
    logging.error("Couldn't find %r", item)
    logging.warning('Feature is deprecated')
    logging.info('Opening file %r, mode=%r', filename, mode)
    logging.debug('Got here')

if __name__ == '__main__':

    main()